package main

import (
	"bufio"
	"fmt"
	"os"
	"log"
	//"strconv"
)

func main(){
	gofile		:= os.Args[0]
	maxstdin	:= os.Args[1]
	log.Println("gofile", gofile)
	log.Println("maxstdin", maxstdin)

	counts	:= make(map[string]int)
	input	:= bufio.NewScanner(os.Stdin)
	length	:= 0
	for input.Scan(){
		counts[input.Text()]++
		length++

		if length > maxstdin {
			break
		}
	}

	for line, n := range counts{
		fmt.Printf("%d\t%s\n", n, line)

		//if n > 1 {
		//	fmt.Printf("%d\t%s\n", n, line)
		//}
	}
}